package com.example.provider.javastudy.thread.threadPool;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * All rights Reserved, Designed By www.maihaoche.com
 *
 * @Package com.example.demo.thread.threadPool
 * @author: 红雪（hongxue@maihaoche.com）
 * @date: 2019/1/16 5:16 PM
 * @Copyright: 2017-2020 www.maihaoche.com Inc. All rights reserved.
 * 注意：本内容仅限于卖好车内部传阅，禁止外泄以及用于其他的商业项目
 */
public class ThreadPoolTest {

    public static void main(String[] args) {
       /* ThreadPool threadPool = new ThreadPool();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        for (int i = 0;i<99;i++){
            Runnable runnable = () -> System.out.println("这是任务"+System.currentTimeMillis());
            threadPool.add(runnable);
        }*/

       //java自带的线程池
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10,15,60, TimeUnit.SECONDS,new LinkedBlockingQueue<>());
        threadPool.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("任务一");
            }
        });
    }
}
